package com.chenken;

import java.util.Arrays;

import com.chenken.student.Student;
import com.chenken.tools.Integers;

public class Test {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Integer[] arrays = Integers.random(30000, 1, 100000);
		test1(arrays,new Sort[] {
						new SelectionSort<Integer>(),
						new BubbleSort3<Integer>(),
						new HeapSort<Integer>(),
						new MergeSort<Integer>()
					}
		);
	}
	
//	public static void main(String[] args) {
//		int num = 5000;
//		Student[] studentArray = new Student[num];
//		for(int i = (num-1);i>=0;i--) {
//			studentArray[num-i-1] = new Student("name-"+i, i);
//		}
//		test2(studentArray,new Sort[] {
//				new SelectionSort<Integer>(),
//				new BubbleSort3<Integer>(),
//				new HeapSort<Integer>()
//			});
//	}
	
	static void test1(Integer[] arrays,Sort<Integer>[] sorts) {
		for(Sort<Integer> sort:sorts) {
			sort.sort(Integers.copy(arrays));
		}
		Arrays.sort(sorts);
		for (Sort<Integer> sort : sorts) {
			System.out.println(sort);
		}
	}
	
	static void test2(Student[] arrays,Sort<Student>[] sorts) {
		for(Sort<Student> sort:sorts) {
			sort.sort(Arrays.copyOf(arrays, arrays.length));
		}
		Arrays.sort(sorts);
		for (Sort<Student> sort:sorts) {
			System.out.println(sort);
		}
	}
	
}
